<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改琦风公寓-每月账单')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-bill-edit" th:object="${qifBill}">
            <input name="billId" th:field="*{billId}" type="hidden">
            <!-- 单元号：改为disabled+隐藏input，实现不可点击且正常提交 -->
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">单元号：</label>
                    <div class="col-sm-8">
                        <!-- 添加disabled属性，完全禁止点击交互 -->
                        <select name="unit" class="form-control m-b" th:with="type=${@dict.getType('qif_room_unit')}" disabled>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
                        </select>
                        <!-- 新增隐藏input，传递单元号值（disabled元素不提交） -->
                        <input type="hidden" name="unit" th:value="*{unit}" />
                    </div>
                </div>
            </div>
            <!-- 房间号：保持readonly，不可编辑且正常提交 -->
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">房间号：</label>
                    <div class="col-sm-8">
                        <input name="roomNum" th:field="*{roomNum}" class="form-control" type="text" required readonly>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">租金：</label>
                    <div class="col-sm-8">
                        <input name="rent" th:field="*{rent}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">押金：</label>
                    <div class="col-sm-8">
                        <input name="deposit" th:field="*{deposit}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">房卡押金：</label>
                    <div class="col-sm-8">
                        <input name="keyCard" th:field="*{keyCard}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">交租日：</label>
                    <div class="col-sm-8">
                        <input name="rentPayDate" th:field="*{rentPayDate}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">上月水表读数：</label>
                    <div class="col-sm-8">
                        <input name="lastMonthWater" th:field="*{lastMonthWater}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">本月水表读数：</label>
                    <div class="col-sm-8">
                        <input name="thisMonthWater" th:field="*{thisMonthWater}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">实际用水量：</label>
                    <div class="col-sm-8">
                        <input name="waterUsage" th:field="*{waterUsage}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">水单价：</label>
                    <div class="col-sm-8">
                        <input name="waterUnitPrice" th:field="*{waterUnitPrice}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">水费：</label>
                    <div class="col-sm-8">
                        <input name="waterRate" th:field="*{waterRate}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">上月电表读数：</label>
                    <div class="col-sm-8">
                        <input name="lastMonthElectricity" th:field="*{lastMonthElectricity}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">本月电表读数：</label>
                    <div class="col-sm-8">
                        <input name="thisMonthElectricity" th:field="*{thisMonthElectricity}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">实际用电量：</label>
                    <div class="col-sm-8">
                        <input name="electricityUsage" th:field="*{electricityUsage}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">电单价：</label>
                    <div class="col-sm-8">
                        <input name="electricityUnitPrice" th:field="*{electricityUnitPrice}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">电费：</label>
                    <div class="col-sm-8">
                        <input name="electricityBill" th:field="*{electricityBill}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">卫生费：</label>
                    <div class="col-sm-8">
                        <input name="sanitationFee" th:field="*{sanitationFee}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">应收款：</label>
                    <div class="col-sm-8">
                        <input name="receivable" th:field="*{receivable}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">实收款：</label>
                    <div class="col-sm-8">
                        <input name="actualPay" th:field="*{actualPay}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">是否结算：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('qif_bill_is_settlement')}">
                            <input type="radio" th:id="${dict.dictCode}" name="isSettlement" th:value="${dict.dictValue}" th:field="*{isSettlement}">
                            <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">账单日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="billDate" th:value="${#dates.format(qifBill.billDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "qif/bill";
        $("#form-bill-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-bill-edit').serialize());
            }
        }

        $("input[name='billDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>